<style>
    .hide-trace{
        display: none;
    }
</style>
<div class="row">
    <div class="col-md-12">
        <div class="box">
            <div class="box-body">
                <form class="form-inline" name="searchForm" id="searchForm" action="" method="GET">

                    <div class="form-group" >
                        <input type="text" value="{$keywords ? $keywords : '' ;}"
                               name="keywords" id="keywords" class="form-control" placeholder="关键字">
                    </div>

                    <div class="form-group">
                        <button class="btn btn-primary" type="submit"><i class="fa fa-search"></i> 查询
                        </button>
                    </div>
                    <div class="form-group">
                        <button onclick="clear_form()" class="btn btn-default" type="button"><i class="fa  fa-eraser"></i> 清空查询
                        </button>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-12">
        <div class="box">
            <!--数据列表页头部-->
            <div class="box-header">
                <h3 class="box-title">{$web_data['web_title']}</h3>
                {if isset($total)}
                共{$total}条记录
                {/if}
            </div>
            <!-- /.box-header -->
            <div class="box-body table-responsive">
                <table id="datalist" class="table table-hover table-bordered datatable" width="100%">
                    <thead>
                    <tr>
                        <th>日志ID</th>
                        <th>错误消息</th>
                        <th>所在文件</th>
                        <th>所在行数</th>
                        <th>记录日期</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>

                    {foreach name="lists" item="list"}
                    <tr>
                        <td>{$list.log_id}</td>
                        <td>{$list.message}</td>
                        <td>{$list.file}</td>
                        <td>{$list.line}</td>
                        <td>{$list.create_time}</td>
                        <td>
                            <a data-toggle="modal" data-target="#modaltrace" onclick="view_trace({$list.log_id})" class="btn btn-default  btn-sm margin" title="查看trace" >
                                查看trace
                            </a>
                            <div id="trace{$list.log_id}" class="hide-trace">
                                {$list->syslogTrace['trace']}
                            </div>
                        </td>
                    </tr>
                    {/foreach}
                    </tbody>
                </table>
            </div>
            <!-- /.box-body -->
            <div class="box-footer">
                <div>

                    <div class="dataTables_paginate paging_simple_numbers">
                        {$page}
                    </div>
                </div>
            </div>
        </div>
        <!-- /.box -->
    </div>
</div>

<div  class="modal fade" id="modaltrace" >
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                    <span aria-hidden="true">×</span></button>
                <h4 class="modal-title">trace</h4>
            </div>
            <div class="modal-body">
                <p id="modal_message"></p>
            </div>
            <div class="modal-footer">
                <button data-dismiss="modal"  type="button" class="btn btn-primary">确定</button>
            </div>
        </div>
        <!-- /.modal-content -->
    </div>
    <!-- /.modal-dialog -->
</div>
<script>
    function view_trace(id) {
        var trace_content = $("#trace"+id).html();
        $("#modal_message").html(trace_content);
    }
</script>